//
//  UIButton+layout.h
//  MIApp
//
//  Created by ZE KANG on 16/9/21.
//  Copyright © 2016年 HongJi. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
typedef NS_ENUM(NSUInteger, MKButtonEdgeInsetsStyle) {
    MKButtonEdgeInsetsStyleTop, // image在上，label在下
    MKButtonEdgeInsetsStyleLeft, // image在右，label在左
    MKButtonEdgeInsetsStyleBottom, // image在下，label在上
    MKButtonEdgeInsetsStyleRight// image在左，label在右  
};
@interface UIButton (layout)
/**
 *  设置button的titleLabel和imageView的布局样式，及间距
 *
 *  @param style titleLabel和imageView的布局样式
 *  @param space titleLabel和imageView的间距
 */
- (void)layoutButtonWithEdgeInsetsStyle:(MKButtonEdgeInsetsStyle)style
                        imageTitleSpace:(CGFloat)space;



- (void)setBackgroundImageByName:(NSString*)imageName;




- (void)setProperty:(UIColor *)backgroundColor textColor:(UIColor *)textColor font:(CGFloat)font title:(NSString *)title;




@end



@interface UIButton (OF)
/**
 *  设置多样式标题(默认状态)
 *
 *  @param title 标题
 */
-(void)setNormalsetAttTitle:(NSAttributedString *)title;
/**
 *  设置标题(默认状态)
 *
 *  @param title 标题
 */
-(void)setNormalTitle:(NSString *)title;
/**
 *  设置标题(选中状态)
 *
 *  @param title 标题
 */
-(void)setSelectTitle:(NSString *)title;
/**
 *  设置标题大小
 *
 *  @param font 大小
 */
-(void)setTitleFont:(float)font;
/**
 *  设置标题颜色(默认状态)
 *
 *  @param titleColor 颜色
 */
-(void)setNormalTitleColor:(UIColor *)titleColor;
/**
 *  设置标题颜色(选中状态)
 *
 *  @param titleColor 颜色
 */
-(void)setSelectTitleColor:(UIColor *)titleColor;
/**
 *  设置图标(默认状态)
 *
 *  @param image 图片
 */
-(void)setNormalImage:(UIImage *)image;


/**
 *  @brief  使用颜色设置按钮背景
 *
 *  @param backgroundColor 背景颜色
 *  @param state           按钮状态
 */
- (void)setBackgroundColor:(UIColor *)backgroundColor forState:(UIControlState)state;


/**
 *  设置选择图标(选择状态)
 *
 *  @param selectimage 选择图片
 */
-(void)setSelectImage:(UIImage *)selectimage;
/**
 *  设置背景图标(默认状态)
 *
 *  @param backImage 背景图片
 */
-(void)setNormalBackImage:(UIImage *)backImage;
/**
 *  设置选择背景图标(选择状态)
 *
 *  @param selectBackImage 选择背景图片
 */
-(void)setSelectBackImage:(UIImage *)selectBackImage;

/**
 *  设置文字偏向
 *
 *  @param textAlignment 偏向
 */
-(void)setTitleTextAlignment:(UIControlContentHorizontalAlignment)textAlignment;

/**
 *  添加点击事件(默认点击状态)
 *
 *  @param target 目标 action 方法名
 */
-(void)AddTarget:(id)target Action:(SEL)action;

/**
 *  设置禁用button高亮
 *
 *  @param Highlighted 给予设置
 */
-(void)setImageWhenHighlighted:(BOOL)Highlighted;

- (void)setNormalBgColor:(UIColor *)normalColor selectedBgColor:(UIColor *)selectedColor highLightedBgColor:(UIColor *)highLightedColor size:(CGSize)size;
- (void)setNormalBgColor:(UIColor *)normalColor selectedBgColor:(UIColor *)selectedColor highLightedBgColor:(UIColor *)highLightedColor;
- (void)setNormalBgColor:(UIColor *)normalColor selectedBgColor:(UIColor *)selectedColor size:(CGSize )size;
- (void)setNormalBgColor:(UIColor *)normalColor selectedBgColor:(UIColor *)selectedColor;
- (void)setNormalBg:(NSString *)normalHex selectedBg:(NSString *)selectedHex size:(CGSize )size;
- (void)setNormalBg:(NSString *)normalHex selectedBg:(NSString *)selectedHex;

@end


@interface UIButton (Init)
+(instancetype)initWithTitle:(NSString *)title titleColor:(NSString *)color titleFont:(CGFloat)font;
+(instancetype)initWithImageName:(NSString *)imageName;
//设置边框
-(void)setBorder;
@end

@interface UIButton (EnlargeTouchArea)
/**
 *  增大按钮的点击范围
 *
 *  @param top
 *  @param right
 *  @param bottom
 *  @param left
 */
- (void) setEnlargeEdgeWithTop:(CGFloat) top right:(CGFloat) right bottom:(CGFloat) bottom left:(CGFloat) left;
@end


@interface UIButton (Block)
- (void)onPerformTo:(void(^)(id sender))Toblock Do:(void(^)(id sender))Doblock;


@end

@interface UIButton (Timer)
/**
 *  倒数计时
 */
-(void)onStartTimerForTitle:(NSString *)title Block:(dispatch_block_t)block;

@end


